<template>
  <div>
     <div class="item" v-for="item of coming" :key="item._id">
       <img :src="item.pic" alt="">
       <div class="p">
         <p class="tit">{{item.title}} </p>
         <p>观众评分:{{item.rating}}</p>
         <p>{{item.labels[1]}}</p>
       </div>
       <div>
         <button @click="handleClick(item._id)">购票</button>
       </div>
     </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      coming:[]
    }
  },
  mounted(){
    this.$http("http://47.108.197.28:4000/api/movie/comingSoon").then(res=>{
      // console.log(res.data.res);
      this.coming = res.data.res;
    })
  },
  methods:{
    handleClick(val){
      this.$router.push(`/movieDetail/${val}`)
    }
  }
}
</script>

<style scoped>
.item{
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-top: 5%;
}
.item>img{
  width: 120px;
  vertical-align: middle;
}
.item>.p{
  width: 45%;
}
/* .item>.p>.tit{
    font-size: 18px;
} */
.item .p p{
  padding: 18px 0;
}
.item button{
  width: 100px;
  height: 50px;
  color: orangered;
  border: 1px solid orangered;
}
</style>